#pragma once
#include"resource.h"
class HeaderDlg : public CAxDialogImpl<HeaderDlg>,public CUpdateUI<HeaderDlg>,public CMessageFilter,public CIdleHandler
{
public:
	enum { IDD = IDD_DIALOG_HEADER };

	virtual BOOL PreTranslateMessage(MSG *pMSG)
	{
		if(m_hWnd)
			return CWindow::IsDialogMessage(pMSG);
		return false;
	}
	virtual BOOL OnIdle()
	{
		return false;
	}
	BEGIN_UPDATE_UI_MAP(HeaderDlg)
	END_UPDATE_UI_MAP()

	BEGIN_MSG_MAP(HeaderDlg)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		MESSAGE_HANDLER(WM_SIZE, OnSize)
		CHAIN_MSG_MAP(CUpdateUI<HeaderDlg>)
	END_MSG_MAP()
	LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
	{

		CMessageLoop* pLoop = _Module.GetMessageLoop();
		ATLASSERT(pLoop != NULL);
		pLoop->AddMessageFilter(this);
		pLoop->AddIdleHandler(this);
		UIAddChildWindowContainer(m_hWnd);

		return true;
	}
	LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
	{
		RECT	rect;
		GetClientRect(&rect);
		bHandled = false;
		return 0;
	}
	/*************************************************************************************************/
	void SetUserName(string name)
	{
		GetDlgItem(IDC_STATIC_NAME).SetWindowText(string2wstring(name).c_str());
	}
};